<!--
    Copyright (c) 2016 VMware, Inc. All Rights Reserved.
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
        
        http://www.apache.org/licenses/LICENSE-2.0
        
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<form name="form" class="form-horizontal" ng-submit="form.$valid && vm.changeSettings(system)" autocomplete="off">     
  <div class="col-md-12">
    <h5>System Settings</h5>
    <hr/>
  </div>
  <div class="col-md-12 col-md-off-set-1 main-content">
    <div class="form-group">
      <label for="hostName" class="col-sm-3 control-label">Host Name:</label>
      <div class="col-sm-7">
        <input type="text" class="form-control" id="hostName" ng-model="system.hostName" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.hostName" name="uHostName" required>                 
        <div ng-messages="form.$dirty && form.uHostName.$error">
          <span ng-message="required">Host name is required.</span>
        </div>
      </div> 
    </div>
    <div class="form-group">
      <label for="urlProtocol" class="col-sm-3 control-label">URL Protocol:</label>
      <div class="col-sm-7">
        <input type="text" class="form-control" id="urlProtocol" ng-model="system.urlProtocol" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.urlProtocol" name="uUrlProtocol" required>                 
        <div ng-messages="form.$dirty && form.uUrlProtocol.$error">
          <span ng-message="required">Url protocol is required.</span>
        </div>
      </div>
    </div>          
    <div class="form-group">
      <label for="emailServer" class="col-sm-3 control-label">Email server:</label>
      <div class="col-sm-7">
        <input type="text" class="form-control" id="emailServer" ng-model="system.emailServer" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.emailServer" name="uEmailServer" required>                 
        <div ng-messages="form.$dirty && form.uEmailServer.$error">
          <span ng-message="required">Email server is required.</span>
        </div>
      </div>
    </div>
    <div class="form-group">
      <label for="ldapUrl" class="col-sm-3 control-label">LDAP URL:</label>
      <div class="col-sm-7">
        <input type="text" class="form-control" id="ldapUrl" ng-model="system.ldapUrl" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.ldapUrl" name="uLdapUrl" required>                 
        <div ng-messages="form.$dirty && form.uLdapUrl.$error">
          <span ng-message="required">LDAP URL is required.</span>
        </div>
      </div>
    </div>
  </div>
  <div class="col-md-12">
  <h5>Registration</h5>
  <hr/>
  </div>
  <div class="col-md-12 col-md-off-set-1 main-content">
    <div class="form-group">
       <label for="registration" class="col-sm-3 control-label">Registration:</label>
       <div class="col-sm-7">
         <select class="form-control" ng-model="vm.currentRegistration" ng-options="r as r.name for r in vm.registrationOptions track by r.value" ng-click="vm.selectRegistration()"></select>
       </div>
    </div>  
    <div class="form-group">
      <div class="col-md-offset-7 col-md-10">
        <input type="submit" class="btn btn-primary" ng-disabled="form.$invalid" value="Save">                    
        <input type="submit" class="btn btn-default" ng-click="vm.cancel()" value="Cancel">
      </div>
    </div>          
  </div>
</form>